package com.ysd.controller;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import com.ysd.entity.Payment;
import com.ysd.service.PaymentService;
import com.ysd.util.CommonsResult;
@RestController
public class PaymentController {
    @Autowired
    private PaymentService paymentService;
    @Value("${server.port}")
    private String serverPort;

    @Autowired
    private DiscoveryClient discoveryClient;

    @GetMapping("payment/get/{id}")
    public CommonsResult<String> getPaymentById(@PathVariable("id") Long id){
    	Payment payment = paymentService.getPaymentById(id);
        if (payment != null) {
            return new CommonsResult<String>(200,"查询数据库成功,serverPort:  "+serverPort,"内容："+payment);
        }else{
            return new CommonsResult<String>(444,"没有对应的记录，查询ID:"+id,null);
        }
    }
}
